<!DOCTYPE html>
<html>

<head>
  <title>Quarkus - Creating Your First Application</title>
  <script id="adobe_dtm" src="https://www.redhat.com/dtm.js" type="text/javascript"></script>
  <script src="/assets/javascript/highlight.pack.js" type="text/javascript"></script>
  <META HTTP-EQUIV='Content-Security-Policy' CONTENT="default-src 'none'; script-src 'self' 'unsafe-eval' 'sha256-ANpuoVzuSex6VhqpYgsG25OHWVA1I+F6aGU04LoI+5s=' 'sha256-ipy9P/3rZZW06mTLAR0EnXvxSNcnfSDPLDuh3kzbB1w=' js.bizographics.com https://www.redhat.com assets.adobedtm.com jsonip.com https://ajax.googleapis.com https://www.googletagmanager.com https://www.google-analytics.com https://use.fontawesome.com; style-src 'self' https://fonts.googleapis.com https://use.fontawesome.com; img-src 'self' *; media-src 'self' ; frame-src https://www.googletagmanager.com https://www.youtube.com; frame-ancestors 'none'; base-uri 'none'; object-src 'none'; form-action 'none'; font-src 'self' https://use.fontawesome.com https://fonts.gstatic.com;">
  <META HTTP-EQUIV='X-Frame-Options' CONTENT="DENY">
  <META HTTP-EQUIV='X-XSS-Protection' CONTENT="1; mode=block">
  <META HTTP-EQUIV='X-Content-Type-Options' CONTENT="nosniff">
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <meta name="description" content="Quarkus: Supersonic Subatomic Java">
  <meta name="twitter:card" content="summary_large_image">
  <meta name="twitter:site" content="@QuarkusIO"> 
  <meta name="twitter:creator" content="@QuarkusIO">
  <meta property="og:url" content="https://quarkus.io/guides/getting-started" />
  <meta property="og:title" content="Quarkus - Creating Your First Application" />
  <meta property="og:description" content="Quarkus: Supersonic Subatomic Java" />
  <meta property="og:image" content="/assets/images/quarkus_card.png" />
  <link rel="canonical" href="https://quarkus.io/guides/getting-started">
  <link rel="shortcut icon" type="image/png" href="/favicon.ico" >
  <link rel="stylesheet" href="https://quarkus.io/guides/stylesheet/config.css" />
  <link rel="stylesheet" href="/assets/css/main.css" />
  <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.1.0/css/all.css" integrity="sha384-lKuwvrZot6UHsBSfcMvOkWwlCMgc0TaWr+30HWe3a4ltaBwTZhyTEggF5tJv8tbt" crossorigin="anonymous">
  <link rel="alternate" type="application/rss+xml"  href="https://quarkus.io/feed.xml" title="Quarkus">
  <script src="https://quarkus.io/assets/javascript/goan.js" type="text/javascript"></script>
  <script src="https://quarkus.io/assets/javascript/hl.js" type="text/javascript"></script>
</head>

<body class="guides">
  <!-- Google Tag Manager (noscript) -->
  <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-NJWS5L"
  height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
  <!-- End Google Tag Manager (noscript) -->

  <div class="nav-wrapper">
  <div class="grid-wrapper">
    <div class="width-12-12">
      <input type="checkbox" id="checkbox" />
      <nav id="main-nav" class="main-nav">
  <div class="container">
    <div class="logo-wrapper">
      
        <a href="/"><img src="/assets/images/quarkus_logo_horizontal_rgb_600px_reverse.png" class="project-logo" title="Quarkus"></a>
      
    </div>
    <label class="nav-toggle" for="checkbox">
      <i class="fa fa-bars"></i>
    </label>
    <div id="menu" class="menu">
      <span>
        <a href="/get-started/" class="">Get Started</a>
      </span>
      <span>
        <a href="/guides/" class="active">Guides</a>
      </span>
      <span>
        <a href="/community/" class="">Community</a>
      </span>
      <span>
        <a href="/support/" class="">Support</a>
      </span>
      <span>
        <a href="/blog/" class="">Blog</a>
      </span>
      <span>
        <a href="https://code.quarkus.io" class="button-cta secondary white">Start Coding</a>
      </span>
    </div>
  </div>
      </nav>
    </div>
  </div>
</div>

  <div class="content">
    <div class="guide">
  <div class="width-12-12">
    <h1 class="text-caps">Quarkus - Creating Your First Application</h1>
    <div class="hide-mobile toc"><ul class="sectlevel1">
<li><a href="#prerequisites">1. Prerequisites</a></li>
<li><a href="#architecture">2. Architecture</a></li>
<li><a href="#solution">3. Solution</a></li>
<li><a href="#bootstrapping-the-project">4. Bootstrapping the project</a>
<ul class="sectlevel2">
<li><a href="#the-jax-rs-resources">4.1. The JAX-RS resources</a></li>
</ul>
</li>
<li><a href="#running-the-application">5. Running the application</a></li>
<li><a href="#using-injection">6. Using injection</a></li>
<li><a href="#development-mode">7. Development Mode</a></li>
<li><a href="#testing">8. Testing</a></li>
<li><a href="#working-with-multi-module-project-or-external-modules">9. Working with multi-module project or external modules</a></li>
<li><a href="#packaging-and-run-the-application">10. Packaging and run the application</a></li>
<li><a href="#banner">11. Configuring the banner</a></li>
<li><a href="#whats-next">12. What&#8217;s next?</a></li>
</ul></div>
    <div>
      <div id="preamble">
<div class="sectionbody">
<div class="paragraph">
<p>Learn how to create a Hello World Quarkus app.
This guide covers:</p>
</div>
<div class="ulist">
<ul>
<li>
<p>Bootstrapping an application</p>
</li>
<li>
<p>Creating a JAX-RS endpoint</p>
</li>
<li>
<p>Injecting beans</p>
</li>
<li>
<p>Functional tests</p>
</li>
<li>
<p>Packaging of the application</p>
</li>
</ul>
</div>
</div>
</div>
<div class="sect1">
<h2 id="prerequisites"><a class="anchor" href="#prerequisites"></a>1. Prerequisites</h2>
<div class="sectionbody">
<div class="paragraph">
<p>To complete this guide, you need:</p>
</div>
<div class="ulist">
<ul>
<li>
<p>less than 15 minutes</p>
</li>
<li>
<p>an IDE</p>
</li>
<li>
<p>JDK 8 or 11+ installed with <code>JAVA_HOME</code> configured appropriately</p>
</li>
<li>
<p>Apache Maven 3.6.2+</p>
</li>
</ul>
</div>
<div class="admonitionblock tip">
<table>
<tr>
<td class="icon">
<i class="fa icon-tip" title="Tip"></i>
</td>
<td class="content">
<div class="title">Verify Maven is using the Java you expect</div>
<div class="paragraph">
<p>If you have multiple JDK&#8217;s installed it is not certain Maven will pick up the expected java
and you could end up with unexpected results.
You can verify which JDK Maven uses by running <code>mvn --version</code>.</p>
</div>
</td>
</tr>
</table>
</div>
</div>
</div>
<div class="sect1">
<h2 id="architecture"><a class="anchor" href="#architecture"></a>2. Architecture</h2>
<div class="sectionbody">
<div class="paragraph">
<p>In this guide, we create a straightforward application serving a <code>hello</code> endpoint. To demonstrate
dependency injection, this endpoint uses a <code>greeting</code> bean.</p>
</div>
<div class="imageblock">
<div class="content">
<img src="/guides/images/getting-started-architecture.png" alt="Architecture">
</div>
</div>
<div class="paragraph">
<p>This guide also covers the testing of the endpoint.</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="solution"><a class="anchor" href="#solution"></a>3. Solution</h2>
<div class="sectionbody">
<div class="paragraph">
<p>We recommend that you follow the instructions from <a href="#bootstrapping-the-project">Boostrapping project</a> and onwards to create the application step by step.</p>
</div>
<div class="paragraph">
<p>However, you can go right to the completed example.</p>
</div>
<div class="paragraph">
<p>Download an <a href="https://github.com/quarkusio/quarkus-quickstarts/archive/master.zip">archive</a> or clone the git repository:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code data-lang="shell" class="language-shell hljs">git clone https://github.com/quarkusio/quarkus-quickstarts.git</code></pre>
</div>
</div>
<div class="paragraph">
<p>The solution is located in the <code>getting-started</code> directory.</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="bootstrapping-the-project"><a class="anchor" href="#bootstrapping-the-project"></a>4. Bootstrapping the project</h2>
<div class="sectionbody">
<div class="paragraph">
<p>The easiest way to create a new Quarkus project is to open a terminal and run the following command:</p>
</div>
<div class="paragraph">
<p>For Linux &amp; MacOS users</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code data-lang="shell" class="language-shell hljs">mvn io.quarkus:quarkus-maven-plugin:1.7.0.Final:create \
    -DprojectGroupId=org.acme \
    -DprojectArtifactId=getting-started \
    -DclassName="org.acme.getting.started.GreetingResource" \
    -Dpath="/hello"
cd getting-started</code></pre>
</div>
</div>
<div class="paragraph">
<p>For Windows users</p>
</div>
<div class="ulist">
<ul>
<li>
<p>If using cmd , (don&#8217;t use forward slash <code>\</code>)</p>
</li>
</ul>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code data-lang="shell" class="language-shell hljs">mvn io.quarkus:quarkus-maven-plugin:1.7.0.Final:create -DprojectGroupId=org.acme -DprojectArtifactId=getting-started -DclassName="org.acme.getting.started.GreetingResource" -Dpath="/hello"</code></pre>
</div>
</div>
<div class="ulist">
<ul>
<li>
<p>If using Powershell , wrap <code>-D</code> parameters in double quotes</p>
</li>
</ul>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code data-lang="shell" class="language-shell hljs">mvn io.quarkus:quarkus-maven-plugin:1.7.0.Final:create "-DprojectGroupId=org.acme" "-DprojectArtifactId=getting-started" "-DclassName=org.acme.getting.started.GreetingResource" "-Dpath=/hello"</code></pre>
</div>
</div>
<div class="paragraph">
<p>It generates the following in  <code>./getting-started</code>:</p>
</div>
<div class="ulist">
<ul>
<li>
<p>the Maven structure</p>
</li>
<li>
<p>an <code>org.acme.getting.started.GreetingResource</code> resource exposed on <code>/hello</code></p>
</li>
<li>
<p>an associated unit test</p>
</li>
<li>
<p>a landing page that is accessible on <code><a href="http://localhost:8080" class="bare">http://localhost:8080</a></code> after starting the application</p>
</li>
<li>
<p>example <code>Dockerfile</code> files for both <code>native</code> and <code>jvm</code> modes in <code>src/main/docker</code></p>
</li>
<li>
<p>the application configuration file</p>
</li>
</ul>
</div>
<div class="paragraph">
<p>Once generated, look at the <code>pom.xml</code>.
You will find the import of the Quarkus BOM, allowing you to omit the version on the different Quarkus dependencies.
In addition, you can see the <code>quarkus-maven-plugin</code> responsible of the packaging of the application and also providing the development mode.</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code data-lang="xml" class="language-xml hljs">&lt;dependencyManagement&gt;
    &lt;dependencies&gt;
        &lt;dependency&gt;
            &lt;groupId&gt;io.quarkus&lt;/groupId&gt;
            &lt;artifactId&gt;quarkus-bom&lt;/artifactId&gt;
            &lt;version&gt;${quarkus.version}&lt;/version&gt;
            &lt;type&gt;pom&lt;/type&gt;
            &lt;scope&gt;import&lt;/scope&gt;
        &lt;/dependency&gt;
    &lt;/dependencies&gt;
&lt;/dependencyManagement&gt;

&lt;build&gt;
    &lt;plugins&gt;
        &lt;plugin&gt;
            &lt;groupId&gt;io.quarkus&lt;/groupId&gt;
            &lt;artifactId&gt;quarkus-maven-plugin&lt;/artifactId&gt;
            &lt;version&gt;${quarkus.version}&lt;/version&gt;
            &lt;executions&gt;
                &lt;execution&gt;
                    &lt;goals&gt;
                        &lt;goal&gt;build&lt;/goal&gt;
                    &lt;/goals&gt;
                &lt;/execution&gt;
            &lt;/executions&gt;
        &lt;/plugin&gt;
    &lt;/plugins&gt;
&lt;/build&gt;</code></pre>
</div>
</div>
<div class="paragraph">
<p>If we focus on the dependencies section, you can see the extension allowing the development of REST applications:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code data-lang="xml" class="language-xml hljs">    &lt;dependency&gt;
        &lt;groupId&gt;io.quarkus&lt;/groupId&gt;
        &lt;artifactId&gt;quarkus-resteasy&lt;/artifactId&gt;
    &lt;/dependency&gt;</code></pre>
</div>
</div>
<div class="sect2">
<h3 id="the-jax-rs-resources"><a class="anchor" href="#the-jax-rs-resources"></a>4.1. The JAX-RS resources</h3>
<div class="paragraph">
<p>During the project creation, the <code>src/main/java/org/acme/getting/started/GreetingResource.java</code> file has been created with the following content:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code data-lang="java" class="language-java hljs">package org.acme.getting.started;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

@Path("/hello")
public class GreetingResource {

    @GET
    @Produces(MediaType.TEXT_PLAIN)
    public String hello() {
        return "hello";
    }
}</code></pre>
</div>
</div>
<div class="paragraph">
<p>It&#8217;s a very simple REST endpoint, returning "hello" to requests on "/hello".</p>
</div>
<div class="admonitionblock tip">
<table>
<tr>
<td class="icon">
<i class="fa icon-tip" title="Tip"></i>
</td>
<td class="content">
<div class="title">Differences with vanilla JAX-RS</div>
<div class="paragraph">
<p>With Quarkus, there is no need to create an <code>Application</code> class. It&#8217;s supported, but not required. In addition, only one instance
of the resource is created and not one per request. You can configure this using the different <code>*Scoped</code> annotations (<code>ApplicationScoped</code>, <code>RequestScoped</code>, etc).</p>
</div>
</td>
</tr>
</table>
</div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="running-the-application"><a class="anchor" href="#running-the-application"></a>5. Running the application</h2>
<div class="sectionbody">
<div class="paragraph">
<p>Now we are ready to run our application.
Use: <code>./mvnw compile quarkus:dev</code>:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code data-lang="shell" class="language-shell hljs">$ ./mvnw compile quarkus:dev
[INFO] --------------------&lt; org.acme:getting-started &gt;---------------------
[INFO] Building getting-started 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ getting-started ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/starksm/Dev/JBoss/Quarkus/starksm64-quarkus-quickstarts/getting-started/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ getting-started ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 2 source files to /Users/starksm/Dev/JBoss/Quarkus/starksm64-quarkus-quickstarts/getting-started/target/classes
[INFO]
[INFO] --- quarkus-maven-plugin:&lt;version&gt;:dev (default-cli) @ getting-started ---
Listening for transport dt_socket at address: 5005
2019-02-28 17:05:22,347 INFO  [io.qua.dep.QuarkusAugmentor] (main) Beginning quarkus augmentation
2019-02-28 17:05:22,635 INFO  [io.qua.dep.QuarkusAugmentor] (main) Quarkus augmentation completed in 288ms
2019-02-28 17:05:22,770 INFO  [io.quarkus] (main) Quarkus started in 0.668s. Listening on: http://localhost:8080
2019-02-28 17:05:22,771 INFO  [io.quarkus] (main) Installed features: [cdi, resteasy]</code></pre>
</div>
</div>
<div class="paragraph">
<p>Once started, you can request the provided endpoint:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-none hljs">$ curl -w "\n" http://localhost:8080/hello
hello</code></pre>
</div>
</div>
<div class="paragraph">
<p>Hit <code>CTRL+C</code> to stop the application, or keep it running and enjoy the blazing fast hot-reload.</p>
</div>
<div class="admonitionblock tip">
<table>
<tr>
<td class="icon">
<i class="fa icon-tip" title="Tip"></i>
</td>
<td class="content">
<div class="title">Automatically add newline with <code>curl -w "\n"</code></div>
<div class="paragraph">
<p>We are using <code>curl -w "\n"</code> in this example to avoid your terminal printing a '%' or put both result and next command prompt on the same line.</p>
</div>
</td>
</tr>
</table>
</div>
</div>
</div>
<div class="sect1">
<h2 id="using-injection"><a class="anchor" href="#using-injection"></a>6. Using injection</h2>
<div class="sectionbody">
<div class="paragraph">
<p>Dependency injection in Quarkus is based on ArC which is a CDI-based dependency injection solution tailored for Quarkus' architecture.
You can learn more about it in the <a href="cdi-reference">Contexts and Dependency Injection guide</a>.</p>
</div>
<div class="paragraph">
<p>ArC comes as a dependency of <code>quarkus-resteasy</code> so you already have it handy.</p>
</div>
<div class="paragraph">
<p>Let&#8217;s modify the application and add a companion bean.
Create the <code>src/main/java/org/acme/getting/started/GreetingService.java</code> file with the following content:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code data-lang="java" class="language-java hljs">package org.acme.getting.started;

import javax.enterprise.context.ApplicationScoped;

@ApplicationScoped
public class GreetingService {

    public String greeting(String name) {
        return "hello " + name;
    }

}</code></pre>
</div>
</div>
<div class="paragraph">
<p>Edit the <code>GreetingResource</code> class to inject the <code>GreetingService</code> and create a new endpoint using it:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code data-lang="java" class="language-java hljs">package org.acme.getting.started;

import javax.inject.Inject;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

import org.jboss.resteasy.annotations.jaxrs.PathParam;

@Path("/hello")
public class GreetingResource {

    @Inject
    GreetingService service;

    @GET
    @Produces(MediaType.TEXT_PLAIN)
    @Path("/greeting/{name}")
    public String greeting(@PathParam String name) {
        return service.greeting(name);
    }

    @GET
    @Produces(MediaType.TEXT_PLAIN)
    public String hello() {
        return "hello";
    }
}</code></pre>
</div>
</div>
<div class="paragraph">
<p>If you stopped the application, restart the application with <code>./mvnw compile quarkus:dev</code>.
Then check that the endpoint returns <code>hello quarkus</code> as expected:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code data-lang="shell" class="language-shell hljs">$ curl -w "\n" http://localhost:8080/hello/greeting/quarkus
hello quarkus</code></pre>
</div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="development-mode"><a class="anchor" href="#development-mode"></a>7. Development Mode</h2>
<div class="sectionbody">
<div class="paragraph">
<p><code>quarkus:dev</code> runs Quarkus in development mode. This enables hot deployment with background compilation, which means
that when you modify your Java files and/or your resource files and refresh your browser, these changes will automatically take effect.
This works too for resource files like the configuration property file.
Refreshing the browser triggers a scan of the workspace, and if any changes are detected, the Java files are recompiled
and the application is redeployed; your request is then serviced by the redeployed application. If there are any issues
with compilation or deployment an error page will let you know.</p>
</div>
<div class="paragraph">
<p>This will also listen for a debugger on port <code>5005</code>. If you want to wait for the debugger to attach before running you
can pass <code>-Dsuspend</code> on the command line. If you don&#8217;t want the debugger at all you can use <code>-Ddebug=false</code>.</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="testing"><a class="anchor" href="#testing"></a>8. Testing</h2>
<div class="sectionbody">
<div class="paragraph">
<p>All right, so far so good, but wouldn&#8217;t it be better with a few tests, just in case.</p>
</div>
<div class="paragraph">
<p>In the generated <code>pom.xml</code> file, you can see 2 test dependencies:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code data-lang="xml" class="language-xml hljs">&lt;dependency&gt;
    &lt;groupId&gt;io.quarkus&lt;/groupId&gt;
    &lt;artifactId&gt;quarkus-junit5&lt;/artifactId&gt;
    &lt;scope&gt;test&lt;/scope&gt;
&lt;/dependency&gt;
&lt;dependency&gt;
    &lt;groupId&gt;io.rest-assured&lt;/groupId&gt;
    &lt;artifactId&gt;rest-assured&lt;/artifactId&gt;
    &lt;scope&gt;test&lt;/scope&gt;
&lt;/dependency&gt;</code></pre>
</div>
</div>
<div class="paragraph">
<p>Quarkus supports <a href="https://junit.org/junit5/">Junit 5</a> tests.
Because of this, the version of the <a href="https://maven.apache.org/surefire/maven-surefire-plugin/">Surefire Maven Plugin</a> must
be set, as the default version does not support Junit 5:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code data-lang="xml" class="language-xml hljs">&lt;plugin&gt;
    &lt;artifactId&gt;maven-surefire-plugin&lt;/artifactId&gt;
    &lt;version&gt;${surefire-plugin.version}&lt;/version&gt;
    &lt;configuration&gt;
       &lt;systemPropertyVariables&gt;
          &lt;java.util.logging.manager&gt;org.jboss.logmanager.LogManager&lt;/java.util.logging.manager&gt;
          &lt;maven.home&gt;${maven.home}&lt;/maven.home&gt;
       &lt;/systemPropertyVariables&gt;
    &lt;/configuration&gt;
&lt;/plugin&gt;</code></pre>
</div>
</div>
<div class="paragraph">
<p>We also set the <code>java.util.logging</code> system property to make sure tests will use the correct logmanager and <code>maven.home</code> to ensure that custom configuration
from <code>${maven.home}/conf/settings.xml</code> is applied (if any).</p>
</div>
<div class="paragraph">
<p>The generated project contains a simple test.
Edit the <code>src/test/java/org/acme/getting/started/GreetingResourceTest.java</code> to match the following content:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code data-lang="java" class="language-java hljs">package org.acme.getting.started;

import io.quarkus.test.junit.QuarkusTest;
import org.junit.jupiter.api.Test;

import java.util.UUID;

import static io.restassured.RestAssured.given;
import static org.hamcrest.CoreMatchers.is;

@QuarkusTest
public class GreetingResourceTest {

    @Test    <i class="conum" data-value="1"></i><b>(1)</b>
    public void testHelloEndpoint() {
        given()
          .when().get("/hello")
          .then()
             .statusCode(200)    <i class="conum" data-value="2"></i><b>(2)</b>
             .body(is("hello"));
    }

    @Test
    public void testGreetingEndpoint() {
        String uuid = UUID.randomUUID().toString();
        given()
          .pathParam("name", uuid)
          .when().get("/hello/greeting/{name}")
          .then()
            .statusCode(200)
            .body(is("hello " + uuid));
    }

}</code></pre>
</div>
</div>
<div class="colist arabic">
<table>
<tr>
<td><i class="conum" data-value="1"></i><b>1</b></td>
<td>By using the <code>QuarkusTest</code> runner, you instruct JUnit to start the application before the tests.</td>
</tr>
<tr>
<td><i class="conum" data-value="2"></i><b>2</b></td>
<td>Check the HTTP response status code and content</td>
</tr>
</table>
</div>
<div class="paragraph">
<p>These tests use <a href="http://rest-assured.io/">RestAssured</a>, but feel free to use your favorite library.</p>
</div>
<div class="paragraph">
<p>You can run these using Maven:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code data-lang="shell" class="language-shell hljs">./mvnw test</code></pre>
</div>
</div>
<div class="paragraph">
<p>You can also run the test from your IDE directly (be sure you stopped the application first).</p>
</div>
<div class="paragraph">
<p>By default, tests will run on port <code>8081</code> so as not to conflict with the running application. We automatically
configure RestAssured to use this port. If you want to use a different client you should use the <code>@TestHTTPResource</code>
annotation to directly inject the URL of the tested application into a field on the test class. This field can be of the type
<code>String</code>, <code>URL</code> or <code>URI</code>. This annotation can also be given a value for the test path. For example, if I want to test
a Servlet mapped to <code>/myservlet</code> I would just add the following to my test:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code data-lang="java" class="language-java hljs">@TestHTTPResource("/myservlet")
URL testUrl;</code></pre>
</div>
</div>
<div class="paragraph">
<p>The test port can be controlled via the <code>quarkus.http.test-port</code> config property. Quarkus also creates a system
property called <code>test.url</code> that is set to the base test URL for situations where you cannot use injection.</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="working-with-multi-module-project-or-external-modules"><a class="anchor" href="#working-with-multi-module-project-or-external-modules"></a>9. Working with multi-module project or external modules</h2>
<div class="sectionbody">
<div class="paragraph">
<p>Quarkus heavily utilizes <a href="https://github.com/wildfly/jandex">Jandex</a> at build time, to discover various classes or annotations. One immediately recongizable application of this, is CDI bean discovery.
As a result, most of the Quarkus extensions will not work properly if this build time discovery isn&#8217;t properly setup.</p>
</div>
<div class="paragraph">
<p>This index is created by default on the project on which Quarkus is configured for, thanks to our Maven and Gradle plugins.</p>
</div>
<div class="paragraph">
<p>However, when working with a multi-module project, be sure to read the <code>Working with multi-module projects</code> section of the
<a href="maven-tooling#multi-module-maven">Maven</a> or <a href="gradle-tooling#multi-module-maven">Gradle</a> guides.</p>
</div>
<div class="paragraph">
<p>If you plan to use external modules (for example, an external library for all your domain objects),
you will need to make these modules known to the indexing process either by adding the Jandex plugin (if you can modify them)
or via the <code>quarkus.index-dependency</code> property inside your <code>application.properties</code> (useful in cases where you can&#8217;t modify the module).</p>
</div>
<div class="paragraph">
<p>Be sure to read the <a href="cdi-reference#bean_discovery">Bean Discovery</a> section of the CDI guide for more information.</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="packaging-and-run-the-application"><a class="anchor" href="#packaging-and-run-the-application"></a>10. Packaging and run the application</h2>
<div class="sectionbody">
<div class="paragraph">
<p>The application is packaged using <code>./mvnw package</code>.
It produces 2 jar files in <code>/target</code>:</p>
</div>
<div class="ulist">
<ul>
<li>
<p><code>getting-started-1.0-SNAPSHOT.jar</code> - containing just the classes and resources of the projects, it&#8217;s the regular
artifact produced by the Maven build;</p>
</li>
<li>
<p><code>getting-started-1.0-SNAPSHOT-runner.jar</code> - being an executable <em>jar</em>. Be aware that it&#8217;s not an <em>über-jar</em> as
the dependencies are copied into the <code>target/lib</code> directory.</p>
</li>
</ul>
</div>
<div class="paragraph">
<p>You can run the application using: <code>java -jar target/getting-started-1.0-SNAPSHOT-runner.jar</code></p>
</div>
<div class="admonitionblock note">
<table>
<tr>
<td class="icon">
<i class="fa icon-note" title="Note"></i>
</td>
<td class="content">
The <code>Class-Path</code> entry of the <code>MANIFEST.MF</code> from the <em>runner jar</em> explicitly lists the jars from the <code>lib</code> directory.
So if you want to deploy your application somewhere, you need to copy the <em>runner</em> jar as well as the <em>lib</em> directory.
</td>
</tr>
</table>
</div>
<div class="admonitionblock note">
<table>
<tr>
<td class="icon">
<i class="fa icon-note" title="Note"></i>
</td>
<td class="content">
Before running the application, don&#8217;t forget to stop the hot reload mode (hit <code>CTRL+C</code>), or you will have a port conflict.
</td>
</tr>
</table>
</div>
</div>
</div>
<div class="sect1">
<h2 id="banner"><a class="anchor" href="#banner"></a>11. Configuring the banner</h2>
<div class="sectionbody">
<div class="paragraph">
<p>By default when a Quarkus application starts (in regular or dev mode), it will display an ASCII art banner. The banner can be disabled by setting <code>quarkus.banner.enabled=false</code> in <code>application.properties</code>,
by setting the <code>-Dquarkus.banner.enabled=false</code> Java System Property, or by setting the <code>QUARKUS_BANNER_ENABLED</code> environment variable to <code>false</code>.
Furthermore, users can supply a custom banner by placing the banner file in <code>src/main/resources</code> and configuring <code>quarkus.banner.path=name-of-file</code> in <code>application.properties</code>.</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="whats-next"><a class="anchor" href="#whats-next"></a>12. What&#8217;s next?</h2>
<div class="sectionbody">
<div class="paragraph">
<p>This guide covered the creation of an application using Quarkus.
However, there is much more.
We recommend continuing the journey with the <a href="building-native-image">building a native executable guide</a>, where you learn about creating a native executable and packaging it in a container.
If you are interested in reactive, we recommend the <a href="getting-started-reactive">Getting started with reactive guide</a>, where you can see how to implement reactive applications with Quarkus.</p>
</div>
<div class="paragraph">
<p>In addition, the <a href="tooling">tooling guide</a> document explains how to:</p>
</div>
<div class="ulist">
<ul>
<li>
<p>scaffold a project in a single command line</p>
</li>
<li>
<p>enable the <em>development mode</em> (hot reload)</p>
</li>
<li>
<p>import the project in your favorite IDE</p>
</li>
<li>
<p>and more</p>
</li>
</ul>
</div>
</div>
</div>
    </div>
  </div>
</div>

  </div>

  <div class="content project-footer">
  <div class="footer-section">
    <div class="logo-wrapper">
      <a href="/"><img src="/assets/images/quarkus_logo_horizontal_rgb_reverse.svg" class="project-logo" title="Quarkus"></a>
    </div>
  </div>
  <div class="grid-wrapper">
    <p class="grid__item width-3-12">Quarkus is open. All dependencies of this project are available under the <a href='https://www.apache.org/licenses/LICENSE-2.0' target='_blank'>Apache Software License 2.0</a> or compatible license.<br /><br />This website was built with <a href='https://jekyllrb.com/' target='_blank'>Jekyll</a>, is hosted on <a href='https://pages.github.com/' target='_blank'>Github Pages</a> and is completely open source. If you want to make it better, <a href='https://github.com/quarkusio/quarkusio.github.io' target='_blank'>fork the website</a> and show us what you’ve got.</p>

    
      <div class="width-1-12 project-links">
        <span>Navigation</span>
        <ul class="footer-links width-1-12">
          
            <li><a href="/">Home</a></li>
          
            <li><a href="/guides">Guides</a></li>
          
            <li><a href="/community/#contributing">Contribute</a></li>
          
            <li><a href="/faq">FAQ</a></li>
          
            <li><a href="/get-started">Get Started</a></li>
          
        </ul>
      </div>
    
      <div class="width-1-12 project-links">
        <span>Contribute</span>
        <ul class="footer-links width-1-12">
          
            <li><a href="https://twitter.com/quarkusio">Follow us</a></li>
          
            <li><a href="https://github.com/quarkusio">GitHub</a></li>
          
            <li><a href="/security">Security&nbsp;policy</a></li>
          
        </ul>
      </div>
    
      <div class="width-1-12 project-links">
        <span>Get Help</span>
        <ul class="footer-links width-1-12">
          
            <li><a href="https://groups.google.com/forum/#!forum/quarkus-dev">Forums</a></li>
          
            <li><a href="https://quarkusio.zulipchat.com">Chatroom</a></li>
          
        </ul>
      </div>
    

    
      <div class="width-3-12 more-links">
        <span>Quarkus is made of community projects</span>
        <ul class="footer-links">
          
            <li><a href="https://vertx.io/" target="_blank">Eclipse Vert.x</a></li>
          
            <li><a href="https://microprofile.io" target="_blank">Eclipse MicroProfile</a></li>
          
            <li><a href="https://hibernate.org" target="_blank">Hibernate</a></li>
          
            <li><a href="https://netty.io" target="_blank">Netty</a></li>
          
            <li><a href="https://resteasy.github.io" target="_blank">RESTEasy</a></li>
          
            <li><a href="https://camel.apache.org" target="_blank">Apache Camel</a></li>
          
            <li><a href="https://code.quarkus.io/" target="_blank">And many more...</a></li>
          
        </ul>
      </div>
    
  </div>
</div>
  <div class="content redhat-footer">
  <div class="grid-wrapper">
    <span class="licence">
      <i class="fab fa-creative-commons"></i><i class="fab fa-creative-commons-by"></i> <a href="https://creativecommons.org/licenses/by/3.0/" target="_blank">CC by 3.0</a> | <a href="https://www.redhat.com/en/about/privacy-policy">Privacy Policy</a>
    </span>
    <span class="redhat">
      Sponsored by
    </span>
    <span class="redhat-logo">
      <a href="https://www.redhat.com/" target="_blank"><img src="/assets/images/redhat_reversed.svg"></a>
    </span>
  </div>
</div>


  <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js" integrity="sha384-8gBf6Y4YYq7Jx97PIqmTwLPin4hxIzQw5aDmUg/DDhul9fFpbbLcLh3nTIIDJKhx" crossorigin="anonymous"></script>
  <script type="text/javascript" src="/assets/javascript/mobile-nav.js"></script>
  <script type="text/javascript" src="/assets/javascript/scroll-down.js"></script>
  <script src="/assets/javascript/satellite.js" type="text/javascript"></script>
  <script src="https://quarkus.io/guides/javascript/config.js" type="text/javascript"></script>
  <script src="/assets/javascript/search-filter.js" type="text/javascript"></script>
  <script src="/assets/javascript/back-to-top.js" type="text/javascript"></script>
</body>

</html>
